<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计数器</title>
</head>
<body>
    <div id="app">
        <p>当前计数:{{count}}</p>
        <!-- 普通用法 -->
        <!-- <button v-on:click="count++">加1</button>
        <button v-on:click="count--">减1</button> -->
        <!-- 绑定函数 -->
        <button v-on:click="increment">加1</button>
        <button v-on:click="decrement">减1</button>
    </div>

    <script src="../vue/vue.js"></script>
    <script>
        const app = new Vue({
            el:'#app',
            data:{
                count:0
            },
            methods:{
                increment(){
                    console.log('我加了');
                    this.count++;
                },
                decrement(){
                    console.log('我减了');
                    this.count--;
                }
            }
        });
    </script>
</body>
</html>